package org.aurora.framework.boot.common.exception;

/**
 * BaseException
 * <pre>
 * description: 基本运行时异常
 * create date: 2025-03-21 21:11:12
 * </pre>
 *
 * @author cao.yong
 */
public class BaseException extends RuntimeException {

    private final Reason reason;

    public BaseException(int code, String message) {
        this(new BaseReason(code, message));
    }

    public BaseException(Reason reason) {
        super(reason.toString());
        this.reason = reason;
    }

    public BaseException(int code, String message, Throwable cause) {
        this(new BaseReason(code, message), cause);
    }

    public BaseException(Reason reason, Throwable cause) {
        super(reason.toString(), cause);
        this.reason = reason;
    }

    public Reason getReason() {
        return reason;
    }
}
